<template>
  <XForm ref="XForm" :formList="formList" :formData="formData" label-width="60px">
    <template v-slot:btn>
      <XBtn :formData="formData" :XForm="$refs['XForm']" @onSubmit="onSubmit" />
    </template>
  </XForm>
</template>

<script>
import rules from '@/utils/rules'
import { XForm } from '@/components/@fhsy/x-tool'
import XBtn from '@/components/common/XBtn'
export default {
  components: { XForm, XBtn },
  data: () => ({
    formList: [
      { label: '昵称', prop: 'name', rules: [{ isNull: true }] },
      { label: '手机', prop: 'phone', rules: [{ isNull: true, message: '手机号必填' }, { regex: /^1[0-9]{10}$/ }] },
      { label: '邮箱', prop: 'email', rules: [{ validator: rules.email }], span: 24 },
      { slot: 'btn', span: 24 }
    ],
    formData: {}
  }),
  methods: {
    onSubmit () {
      this.$message(`回调: ${JSON.stringify(this.formData)}`)
    }
  }
}
</script>
